package com.tianxia120.website.admin.controller;

import com.jfinal.aop.Before;
import com.jfinal.aop.Inject;
import com.jfinal.core.paragetter.Para;
import com.jfinal.upload.UploadFile;
import com.tianxia120.website.admin.service.BannerService;
import com.tianxia120.website.bean.model.Banner;
import com.tianxia120.website.data.controller.BaseController;
import com.tianxia120.website.data.interceptors.Get;
import com.tianxia120.website.data.interceptors.Post;

/**
 * @createTime: 2018/9/21 13:44
 * @author: HingLo
 * @description: banner相关处理
 */
public class BannerController extends BaseController {
    @Inject
    private BannerService bannerService;

    /**
     * 查询全部的Banner列表
     */
    @Before(Get.class)
    public void list() {
        success(bannerService.listService());
    }

    /***
     * 添加banner图
     * @param banner banner图对象信息
     * @param img img
     */
    @Before(Post.class)
    public void add(@Para("") Banner banner, UploadFile img) {
        result(bannerService.addService(banner, img));
    }


}
